home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
cuj1008.zip
/
RAMEY.ZIP
/
815.ZIP
/
RECORD.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-28
|
2KB
|
55 lines
/*
Postman's Sort (R) Version 1.0
Copyright (c) Robert Ramey 1991. All Rights Reserved
*/
#include "stack.h"
/*********************************************************************
data structure and data for each data memory held in memory or in
the working file
**********************************************************************/
/* structure for a record */
typedef union {
size_t field[1]; /* displacement of fields with in record */
unsigned char data[1]; /* actual record data */
} RECORD;
/* The usage of a RECORD is as follows:
field[0] Total length of record
field[1] displacement of first field
...
field[n] displacement of n th field
blk num one character containing block number
num data bytes added to permit sorting of numerics
starts at data_offset
byte data data contained in record
starts at record_offset
*/
extern size_t record_size;
extern size_t record_offset;
extern STACK *d_stack;
#define blk_offset (record_offset-1)
/* data[blk_offset] will contain one of three fields
* depending on what state the record is currently in:
*/
/* when record is stored in stack memory, it contains the number */
/* of the stack frame */
#define rec_frame(ra) (ra->data[blk_offset])
/* when it is stored on disk it contains a flag indicating that is */
/* is the last record in a chain for the current sublist */
#define rec_eob(ra) (ra->data[blk_offset])
/* after the record has been retrieved but before it has been attached */
/* to a new sublist or sent to output this field contains a flag indicating */
/* its provenance. */
#define rec_memflag(ra) (ra->data[blk_offset])
#define rec_size(ra) (ra->field[0])
void
rec_init(int, char **);
RECORD *
rec_variable();
RECORD *
rec_fixed();
void
rec_output(RECORD *);